]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Pass a Graphene.Point as PickPixel 'finished' signal
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 2 Sep 2019 23:51:00 +0000 (01:51 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Wed, 16 Oct 2019 15:26:13 +0000 (15:26 +0000)
This will allow to pass the data as native object when porting this to Clutter
actor.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559

js/ui/screenshot.js

index bbc1be499c39cb001a5bbf937e30c37484824636..f3d1d02ddf32e23c3e5df2e3481cdc67ae8781fc 100644 (file)
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported ScreenshotService */
 
-const { Clutter, Gio, GLib, Meta, Shell, St } = imports.gi;
+const { Clutter, Graphene, Gio, GLib, Meta, Shell, St } = imports.gi;
 const Signals = imports.signals;
 
 const GrabHelper = imports.ui.grabHelper;
@@ -198,7 +198,7 @@ var ScreenshotService = class {
                 let screenshot = this._createScreenshot(invocation, false);
                 if (!screenshot)
                     return;
-                screenshot.pick_color(...coords, (o, res) => {
+                screenshot.pick_color(coords.x, coords.y, (_o, res) => {
                     let [success_, color] = screenshot.pick_color_finish(res);
                     let { red, green, blue } = color;
                     let retval = GLib.Variant.new('(a{sv})', [{
@@ -349,7 +349,8 @@ var PickPixel = class {
     }
 
     _onButtonRelease(actor, event) {
-        this._result = event.get_coords();
+        let [x, y] = event.get_coords();
+        this._result = new Graphene.Point({ x, y });
         this._grabHelper.ungrab();
         return Clutter.EVENT_PROPAGATE;
     }